package com.gitee.wsl.logger

fun interface LogFormatter {
    fun format(level: LogLevel, tag: String, messageAny: Any?, throwable: Throwable?):String
}

/**
 * 设置日志格式
 */
fun LogPrinter.format(formatter: LogFormatter) =
    intercept { logPrinter, level, tag, messageAny, throwable ->
        val formattedMessage = formatter.format(level, tag, messageAny, throwable)
        logPrinter.log(level, tag, formattedMessage, throwable)
    }